package net.oschina.app.com.oschina.pages;

import android.widget.Button;
import android.widget.EditText;

import junit.framework.Assert;

import net.oschina.app.SoloWrap;

/**
 * Created by Administrator on 2017/1/5.
 */

public class LoginDetailPage {

    private SoloWrap solo;
    private EditText account,password;
    private Button login_btn;

    public LoginDetailPage(SoloWrap solo){
        this.solo = solo;
    }

    public void initViews(){
        account = (EditText) solo.getView("net.oschina.app:id/et_username");
        password = (EditText) solo.getView("net.oschina.app:id/et_password");
        login_btn = (Button) solo.getView("net.oschina.app:id/btn_login");
    }

    public void enterAccount(){
        solo.enterText(account,"2277144876");
    }

    public void clearAccount(){
        solo.clearEditText(account);
    }

    public void enterPassword(){
        solo.enterText(password,"yan1992");
    }

    public void clearPassword(){
        solo.clearEditText(password);
    }

    public void clickLoginBtn(){
        solo.clickOnView(login_btn);
    }

    public void login(String account1,String password1){
        solo.clearEditText(account);
        solo.enterText(account,account1);
        solo.clearEditText(password);
        solo.enterText(password,password1);
        solo.clickOnView(login_btn);
    }

    public void islogin(){
        Boolean islogin= solo.searchText("用户名或口令错");
        Assert.assertTrue(islogin);
    }

}
